% 信号提取分析接口测试
clc;
clear;

bin_file_path = "D:\Project\Data\2023-05-30-23-42-02\Rawdata_FPGA1_Frame5.bin";
acq_parameter_file_path = "";
modality = 1;
selected_channels = [1 16 32 48 64];
valid_data_only = 0;
range = [1, 300];
signal_extract = PAUSSignalExtract(bin_file_path, acq_parameter_file_path, modality, selected_channels, valid_data_only, range);

plot(signal_extract.signals,'LineWidth',4);

%% 时域信号提取分析
% signal_output= PAUSSignalSpectrumFromSignal(signal_extract,1,[1 16 32 48 64],1,[4011 4510],'time_domain');
% signal_output = PAUSSignalSpectrumFromBin(10,0,[1 16 32 48 64],1,[8021 8520],'hilbert_envelope');
% 
% plot(signal_output.signals,'LineWidth',4);

%% 频域信号提取分析
signal_output = PAUSSignalSpectrumFromSignal(signal_extract,0,[1 16 32 48 64],1, [8021 8520],'phase_frequency');
% signal_output = PAUSSignalSpectrumFromBin(10,1,[1 16 32 48 64],1,[4011 4510],'amplitude_frequency');

Fs =200e6;
FFTLength =10e5;
frency_x=((0:FFTLength/2-1)*Fs/FFTLength)';  %信号频域

plot(frency_x(1:30000,1),signal_output.signals,'LineWidth',4);

%% 分析参数设置
grid on
set(gca,'linewidth',3)
xlim(signal_output.XAxisTickLabel);
ylim(signal_output.YAxisTickLabel);
xlabel(signal_output.XAxisLabel,'fontname', 'times new roman','fontSize',30);
ylabel(signal_output.YAxisLabel,'fontname', 'times new roman','fontSize',30);
set(gca,'FontSize',18,'Fontname', 'Times New Roman','FontWeight','bold','LineWidth',5);
box off
ax2 = axes('Position',get(gca,'Position'),...
           'XAxisLocation','top',...
           'YAxisLocation','right',...
           'Color','none',...
           'XColor','k','YColor','k','LineWidth',5,'LineWidth',5);
set(ax2,'YTick', []);
set(ax2,'XTick', []);


